package com.weic.design.strategy;

public class Cat implements Comparable<Cat>{
    private int age;
    private String name;

    public Cat(int age, String name) {
        this.age = age;
        this.name = name;
    }

    @Override
    public int compareTo(Cat o) {
        if(age>o.age){
            return 1;
        }else if(age<o.age){
            return -1;
        }else return 0;
    }

    @Override
    public String toString() {
        return "Cat{" +
                "age=" + age +
                ", name='" + name + '\'' +
                '}';
    }
}
